home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Input / IFOParser / ifo_pgci.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-06  |  1.6 KB  |  73 lines

  1.  
  2. /*
  3.  * PGROGRAM CHAIN INFORMATION
  4.  *
  5.  * Copyright (C) 1998,1999  Thomas Mirlacher
  6.  *
  7.  * This program is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; either version 2 of the License, or
  10.  * (at your option) any later version.
  11.  * 
  12.  * This program is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with this program; if not, write to the Free Software
  19.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  * 
  21.  * The author may be reached as dent@cosy.sbg.ac.at, or
  22.  * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
  23.  * Austria
  24.  *
  25.  *------------------------------------------------------------
  26.  *
  27.  */
  28.  
  29.  
  30. #ifdef PARSER
  31. #include <stdio.h>
  32. #endif
  33. #include <sys/types.h>
  34. //#include <unistd.h>
  35. #include "ifo.h"
  36.  
  37. #include "misc.h"
  38. #include "decode.h"
  39.  
  40. #define PGCI_SUB_LEN 8
  41.  
  42. typedef struct {
  43.     u_short id        : 16;    // Language
  44.     u_short            : 16;    // don't know
  45.     u_int    start        : 32;    // Start of unit
  46. } pgci_sub_t;
  47.  
  48.  
  49. /**
  50.  *
  51.  */
  52.  
  53. int ifoGetPGCI (ifo_hdr_t *hdr, int title, char **ptr)
  54. {
  55.     pgci_sub_t *pgci_sub;
  56.  
  57.     *ptr = (char *) hdr;
  58.  
  59.     if (!*ptr)
  60.         return -1;
  61.  
  62.     if (title > hdr->num)
  63.         return -1;
  64.  
  65.     *ptr += IFO_HDR_LEN;
  66.  
  67.     pgci_sub = (pgci_sub_t *) *ptr + title;
  68.  
  69.     *ptr = (char *) hdr + bswap_32 (pgci_sub->start);
  70.  
  71.     return 0;
  72. }
  73.